Welcome.
In this lecture, I want to show you a neat instance called Trails, and this is where you can add dynamic
and visually appealing effects into your games.
Now, a trail is an instance that requires attachments in order to work.
Specifically, you need to attachments that define the starting and ending point for the trail.
And for the trail to be emanated, it needs a bass part parent for it to work.
So we're going to create some attachments in here, and these attachments are going to represent the
starting and ending point for my trail.
So specifically for this part, I'm going to move this attachment to be at the very end here and move
it towards the back.
And then I can duplicate this attachment and do it at the other end here as well.
So what you can imagine is that there is a line between this attachment and this attachment going across
the brick.
And what I put a trail on this brick.
It's going to create a line from this point to this point.
And when I move the brick, it'll have this flat surface or this flat trail coming out of my part.
So we can add a trail into my part.
And then I can specify the attachments for the trail.
So we'll do that one and that one.
Now what you'll see is that when I move my part, you'll see a trail come out the end.
Just like that.
So this is the trail that is emanating from my part.
Now trails have a bunch of properties in here that we can mess around with and we'll go with the first
one, which is color.
Pretty self explanatory.
We can pick any kind of color we'd like for our trail and we can also change the color over time based
on the lifetime of our trail.
But I'm going to leave it.
I guess that green is fine.
Inside this trail.
We can change if we want the trail to face the camera.
So that means no matter what direction I'm looking at, this part, the trail is always going to be
oriented towards my camera, just like that.
So I'll showcase it again.
Let me just put some trails in here and you can see that the trail is following with an orientation
towards my camera.
The next property is light emission and light influence, and these are basically the same for the other
light emission and light influence properties that we've seen.
So if I go and set light influence to zero, that means any lighting in my game is not going to have
an effect on my trail.
And if I set the light emission to something like one, I'm kind of emitting the blending of colors
with this particular color here.
But we'll just leave it at the default.
We can also apply textures to our trails, so let's demonstrate that we'll go to the home tab and open
up the toolbox and we can just pick a random image in here.
We'll just do giga Chad, because why not?
And then we can paste that texture ID in there.
We don't need this anymore.
And now if I move my trail.
There we go.
We have green giga Chad.
And this texture will continue to stretch for however long the duration is and how far my part moves.
But if you don't want the trail to stretch, that's where these other properties come in.
So in here we can define a texture length in studs, basically the maximum amount of vertical height
for our image, and that's only applied if we pick static or wrap for our texture mode.
Obviously, stretch means that the texture gets stretched and it will ignore this texture like property.
But if I set to something like static and then move my part, you will see that the texture will repeat
itself.
And each texture, its height, is one stud from this point to that point.
Now, what's the difference between static and rap?
Well, static means is that when the texture is drawn, you can see they're static and they don't move
with the part.
But if I change it to rap when it creates new textures, you can see that these textures are following
my part.
They're going along and following the trail.
That's just the difference between those two.
And if I go in here and I change the texture length to be something like four studs, you can see that
change as well.
So now my image is four studs in height.
We also have transparency for our trail as well, so we can make it to be completely opaque so you can't
see through it at all.
And of course, you can also adjust this over time.
And then some other settings we have in here is like enabled whether or not the trail is showing up
pretty easy.
Lifetime.
This is how long the trail will last before it decays.
And of course you can set kind of how long you want this to be upwards of 20 seconds, or you can make
it really short.
You can barely see the trail at all because it's decaying and 0.0 1 seconds.
We can also define the maximum length and the minimum length that our trail has to be.
So let's say my lifetime was 10 seconds.
I could set a maximum length for this trail, such as ten studs.
That way, if my part travels greater than ten studs, the trail won't be larger than ten studs.
You'll see, my trail is getting limited to a length of ten studs.
But if I increase it to something like 50.
Then it should.
Come longer.
That I changed the wrong property.
Oh, it didn't change it.
50.
There we go.
Now you can see that my trail is much longer.
And we'll set the lifetime back to be something like one second.
And then we also have something called width scale.
And this is the scale of our image or our trail from the starting point to the ending point, the two
attachments.
So if I change this to 0.5, then it's going to be half the size of our regular trail, as you can see
right there.
And of course, you can also adjust this to be different over time.
So maybe at the beginning my trail can be huge and then it can decay close to nothing over time.
So if I go and move my part, you can see that my trail shrinks over time.
Pretty neat.
Other than that, the trail instance and the Roadblocks API is a very powerful tool for creating visually
interesting and dynamic effects in your game.
By using the various properties and methods available, you can customize the appearance and behavior
of the trail to achieve a wide range of effects to enhance the overall experience for your game.